//
//  WorkerModel.m
//  Btpin
//
//  Created by Vic on 2019/3/26.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "WorkerModel.h"

@implementation WorkerModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.showTime = @"";
    self.id = [UIToolsControl dataAnalysis:keyedValues[@"id"]];
    self.resume_id = [UIToolsControl dataAnalysis:keyedValues[@"resume_id"]];
    self.stauts = [UIToolsControl dataAnalysis:keyedValues[@"stauts"]];
    self.apply_time = [UIToolsControl dataAnalysis:keyedValues[@"apply_time"]];
    self.apply_timeYYYYMMDD = (self.apply_time)?[UIToolsControl timestampConversionTime:([self.apply_time integerValue]) andFormat:@"yyyy-MM-dd"]:@"";
    if (self.apply_time && self.apply_time.length) {
        self.showTime = [UIToolsControl timestampConversionTime:([self.apply_time integerValue]) andFormat:@"yyyy-MM-dd"];
    }
    
    self.view_time = [UIToolsControl dataAnalysis:keyedValues[@"view_time"]];
    self.view_timeMMDD = (self.view_time)?[UIToolsControl timestampConversionTime:([self.view_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    if (self.view_time && self.view_time.length) {
        self.showTime = [UIToolsControl timestampConversionTime:([self.view_time integerValue]) andFormat:@"MM月-dd日"];
    }
    
    self.userid = [UIToolsControl dataAnalysis:keyedValues[@"userid"]];
    self.avatar = [UIToolsControl dataAnalysis:keyedValues[@"avatar"]];
    self.name = [UIToolsControl dataAnalysis:keyedValues[@"name"]];
    self.sex = [UIToolsControl dataAnalysis:keyedValues[@"sex"]];
    self.sex_cn = [UIToolsControl dataAnalysis:keyedValues[@"sex_cn"]];
    self.age = [UIToolsControl dataAnalysis:keyedValues[@"age"]];
    self.education_cn = [UIToolsControl dataAnalysis:keyedValues[@"education_cn"]];
    self.experience_cn = [UIToolsControl dataAnalysis:keyedValues[@"experience_cn"]];
    self.wage_cn = [UIToolsControl dataAnalysis:keyedValues[@"wage_cn"]];
    self.update_time = [UIToolsControl dataAnalysis:keyedValues[@"update_time"]];
    self.update_timeMMDD = (self.update_time)?[UIToolsControl timestampConversionTime:([self.update_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    if (self.update_time && self.update_time.length) {
        self.showTime = [UIToolsControl timestampConversionTime:([self.update_time integerValue]) andFormat:@"MM月-dd日"];
    }
    
    self.is_match = [UIToolsControl dataAnalysis:keyedValues[@"is_match"]];
    self.is_contact = [UIToolsControl dataAnalysis:keyedValues[@"is_contact"]];
    
    self.nature = [UIToolsControl dataAnalysis:keyedValues[@"nature"]];
    self.education = [UIToolsControl dataAnalysis:keyedValues[@"education"]];
    
    self.job_id = [UIToolsControl dataAnalysis:keyedValues[@"job_id"]];
    self.job_title = [UIToolsControl dataAnalysis:keyedValues[@"job_title"]];
    
    self.auth_medal = [UIToolsControl dataAnalysis:keyedValues[@"auth_medal"]];
    
    self.favorite_time = [UIToolsControl dataAnalysis:keyedValues[@"favorite_time"]];
    self.favorite_timeMMDD = (self.favorite_time)?[UIToolsControl timestampConversionTime:([self.favorite_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    if (self.favorite_time && self.favorite_time.length) {
        self.showTime = [UIToolsControl timestampConversionTime:([self.favorite_time integerValue]) andFormat:@"MM月-dd日"];
    }
    
    self.intention_jobs = @"";
    self.intention_jobsArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"intention_jobs"] && [keyedValues[@"intention_jobs"] isKindOfClass:[NSArray class]]) {
        if (keyedValues[@"intention_jobs"] && [keyedValues[@"intention_jobs"] count]) {
            for (NSString *str in keyedValues[@"intention_jobs"]) {
                [self.intention_jobsArray addObject:str];
            }
        }
    } else if (keyedValues[@"intention_jobs"] && [keyedValues[@"intention_jobs"] isKindOfClass:[NSString class]]) {
        self.intention_jobs = [UIToolsControl dataAnalysis:keyedValues[@"intention_jobs"]];
    }
    
    self.tagsArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"tags"] && [keyedValues[@"tags"] count]) {
        for (NSString *str in keyedValues[@"tags"]) {
            [self.tagsArray addObject:str];
        }
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)copyWithZone:(NSZone *)zone {
    WorkerModel *model = [[[self class] allocWithZone:zone] init];
    model.id = self.id;
    model.resume_id = self.resume_id;
    model.intention_jobs = self.intention_jobs;
    model.stauts = self.stauts;
    model.apply_time = self.apply_time;
    model.apply_timeYYYYMMDD = self.apply_timeYYYYMMDD;
    
    model.favorite_time = self.favorite_time;
    model.favorite_timeMMDD = self.favorite_timeMMDD;
    
    model.view_time = self.view_time;
    model.view_timeMMDD = self.view_timeMMDD;
    
    model.userid = self.userid;
    model.avatar = self.avatar;
    model.name = self.name;
    model.sex = self.sex;
    model.sex_cn = self.sex_cn;
    model.age = self.age;
    model.experience_cn = self.experience_cn;
    model.education_cn = self.education_cn;
    model.wage_cn = self.wage_cn;
    model.intention_jobsArray = [NSMutableArray arrayWithCapacity:0];
    [model.intention_jobsArray addObjectsFromArray:self.intention_jobsArray];
    model.tagsArray = [NSMutableArray arrayWithCapacity:0];
    [model.tagsArray addObjectsFromArray:self.tagsArray];
    model.update_time = self.update_time;
    model.update_timeMMDD = self.update_timeMMDD;
    
    model.is_match = self.is_match;
    model.is_contact = self.is_contact;
    
    model.nature = self.nature;
    model.education = self.education;
    model.job_id = self.job_id;
    model.job_title = self.job_title;
    
    model.auth_medal = self.auth_medal;
    
    return model;
}

@end
